﻿'Params
'artist (Required (unless mbid)] :The name of the artist you would like to fetch event listings for.
'mbid (Optional) : The musicbrainz id for the artist
'page (Optional) :The page of results to return.
'autocorrect[0|1] (Optional) : Transform misspelled artist names into correct artist names, returning the correct version instead. The corrected artist name will be returned in the response.
'limit (Optional) : The number of results to fetch per page. Defaults to 50.
'api_key (Required) : A Last.fm API key.

'Auth
' This service does not require authentication. 

Public Structure ArtistGetPastEventsResponse
    Dim artist As Artist
End Structure

Public Class ArtistGetPastEvents
	Inherits BaseRequest
	Dim artist As String = ""
	Dim mbid As String = ""
	Dim autocorrect As String = ""
	Dim limit As String = ""
	Dim page As String = ""

	Public xmlresponse As XDocument = Nothing

	Public Sub New(artist As String, mbid As String, autocorrect As String, limit As String, page As String)
		Me.artist = artist
		Me.mbid = mbid
		Me.autocorrect = autocorrect
		Me.limit = limit
		Me.page = page
	End Sub

	Public Sub sendRequest()
        InitializeMembers("Artist.getPastEvents")

        AddMember("artist", artist, String.IsNullOrEmpty(mbid))
        AddMember("page", page, False)
        AddMember("limit", limit, False)
        AddMember("mbid", mbid, False)
        AddMember("autocorrect", autocorrect, False)
        AddMember("api_key", My.Settings.api_key, False)

        xmlresponse = sendPOSTResponse()
	End Sub

	Public Function getResponse() As ArtistGetPastEventsResponse
        Dim response As ArtistGetPastEventsResponse = Nothing

        Try
            response.artist = New Artist(xmlresponse.<lfm>.<artist>.First)
        Catch ex As Exception

        End Try
		Return New ArtistGetPastEventsResponse
	End Function

End Class
